angular.module('module.advertisement').controller('AdListController', AdListController);

AdListController.$inject = ['$state', 'AdvertisementService', '$localStorage'];

function AdListController($state, AdvertisementService, $localStorage) {

    var vm = this;
    vm.stateGo = stateGo;
    if (!$localStorage[environmental + "shopid"]) {
        $localStorage.$reset();
        $state.go('login');
    }
    var shopid = $localStorage[environmental + "shopid"];

    AdvertisementService.getAdvByShopId(shopid, 1).$promise.then(function (data) {
        vm.orderList = data;
    }, function (error) {
    });

    function stateGo(state, id) {
        $state.go(state, {id: id});
    }

}